-
Notifications
You must be signed in to change notification settings - Fork 769
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: allow passing a filterset class to the filterset factory #1636
fix: allow passing a filterset class to the filterset factory #1636
Conversation
The custom implementation did not allow to use custom Meta attributes, therefore we are backporting the one we proposed on carltongibson/django-filter#1636
The custom implementation did not allow to use custom Meta attributes, therefore we are backporting the one we proposed on carltongibson/django-filter#1636
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @b1rger — this looks good.
Could you add a test or two using the new argument? Specifically, interested in the base filter set defining some properties to be reused, fields and meta options: inheritance of meta options needs testing. Also we should doc this.
done |
FTR: currently the |
It's probably worth comparing how |
They are passing
I can update the code accordingly, if its ok to change the |
They're subclassing the But yes, as long as we maintain the effective existing behaviour where |
4fed365
to
a594860
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1636 +/- ##
=======================================
Coverage 98.59% 98.59%
=======================================
Files 15 15
Lines 1283 1284 +1
=======================================
+ Hits 1265 1266 +1
Misses 18 18 ☔ View full report in Codecov by Sentry. |
ack, the |
Hm, scratch that, i pushed too fast, i'll have to rethink the logic... |
a594860
to
75f0cf2
Compare
Oke, I think I found an approach that should not lead to surprises: if the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I think this looks good. Just the one comment.
result, params = filterset.filter_for_lookup(f, "isnull") | ||
self.assertEqual(result, BooleanFilter) | ||
|
||
def test_filtesret_factory_base_filter_meta_inheritance_exclude(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you check the typos in the test method names please? (Same with test above too.)
Updated in #1644 |
I've tried to reuse the variable name terminology from
django.forms.models.modelform_factory
Closes: #1631